package cn.com.surker.sale.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * 销售日产值报表,包含日产值和补贴数据
 *
 * @author luotao
 * @date 2024/5/15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sale_contract_day_price")
public class ContractDayPrice {

	private static final long serialVersionUID = 1L;

	//	销售未确认
	public static final int SALE_CHECK_NO = 0;

	//	销售已确认
	public static final int SALE_CHECK_YES = 1;

	//	财务未确认
	public static final int FINANCE_CHECK_NO = 0;
	//	财务确认
	public static final int FINANCE_CHECK_YES = 1;

	@TableId(value = "id", type = IdType.AUTO)
	private Long id;

	/**
	 * 站点id
	 */
	private Long orgId;

	/**
	 * 站点名称
	 */
	private String orgName;

	/**
	 * 数据源id
	 */
	private Long dsId;

	/**
	 * 数据源编码
	 */
	private String dsCode;

	/**
	 * 日期
	 */
	private String day;

	/**
	 * 结算时间
	 */
	private String billTime;

	/**
	 * 结算时间点类型,0为公司默认的08:30:00;1为客户的结算时间
	 */
	private Integer billTimeType;

	/**
	 * oa本地的合同id
	 */
	private Long conId;

	/**
	 * erp的合同id
	 */
	private Long erpConId;

	/**
	 * 合同编号
	 */
	private String conCode;

	/**
	 * 合同名称
	 */
	private String conName;

	/**
	 * 客户名称
	 */
	private String clientName;

	/**
	 * 施工单位
	 */
	private String developmentUnits;

	/**
	 * 销售人员
	 */
	private String salesman;


	/**
	 * 任务单id
	 */
	private Long indentId;

	/**
	 * 任务单编号
	 */
	private String indentCode;

	/**
	 * erp中的任务单id
	 */
	private Long erpIndentId;

	/**
	 * 施工部位
	 */
	private String indentSite;

	/**
	 * 统计方式(0：自动。1：手动)
	 */
	private Integer isAuto;

	/**
	 * 是否结算,0是要结算,1是不结算
	 */
	private Integer isBill;
	/**
	 * 价格类型,0是产值,1是补贴
	 */
	private Integer priceType;

	/**
	 * 强度等级(补贴类型用作补贴方式)
	 */
	private Long strengthId;

	/**
	 * 强度等级(补贴类型用作补贴方式)
	 */
	private String strengthLevel;

	/**
	 * 特性要求(补贴类型用作计算方式)
	 */
	private Long techId;
	/**
	 * 特性要求(补贴类型用作计算方式)
	 */
	private String techRequirements;

	/**
	 * 销售方量(补贴类型用作计算方量)
	 */
	private Double saleStere;

	/**
	 * 砼单价(补贴类型用作补贴单价)
	 */
	private Double levelPrice;

	/**
	 * 砼总价(补贴类型用作补贴总价)
	 */
	private Double totalLevelPrice;

	/**
	 * 泵送方式(补贴类型用做泵送规格)
	 * 实际应该是浇筑方式,原来整错了
	 */
	private Long pumpId;

	/**
	 * 泵送方式(补贴类型用做泵送规格)
	 */
	private String pumpType;

	/**
	 * 泵送单价
	 */
	private Double pumpPrice;

	/**
	 * 泵送总价
	 */
	private Double totalPumpPrice;

	/**
	 * 销售确认,0为待确认,1为已经确认
	 */
	private Integer saleCheck;

	@TableField(exist = false)
	private String saleCheckStr;

	/**
	 * 销售确认人员
	 */
	private Long saleCheckUser;

	private String saleCheckUserName;

	public String getSaleCheckStr() {
		if (saleCheck != null && saleCheck == SALE_CHECK_YES) {
			return getSaleCheckUserName();
		} else {
			return "等待确认";
		}
	}

	/**
	 * 销售确认时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date saleCheckTime;

	/**
	 * 财务确认,0为待确认,1为已经确认
	 */
	private Integer financeCheck;

	@TableField(exist = false)
	private String financeCheckStr;

	/**
	 * 财务确认人员
	 */
	private Long financeCheckUser;

	/**
	 * 财务确认人员
	 */
	private String financeCheckUserName;

	/**
	 * 财务确认时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date financeCheckTime;

	public String getFinanceCheckStr() {
		if (financeCheck != null && financeCheck == FINANCE_CHECK_YES) {
			return getFinanceCheckUserName();
		} else {
			return "等待确认";
		}
	}

	/**
	 * 状态
	 */
	private Integer status;

	/**
	 * 创建时间
	 */
	@TableField(fill = FieldFill.INSERT, update = "now()")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date createTime;

	/**
	 * 创建人员
	 */
	private String creater;

	/**
	 * 修改时间
	 */
	@TableField(fill = FieldFill.UPDATE, update = "now()")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date updateTime;

	/**
	 * 修改人员
	 */
	private String updater;

	/**
	 * 备注
	 */
	private String remarks;

	/**
	 * 发货方式,1:砼;2:站内接水;3:现场接水;5:砂浆;
	 */
	private Integer invoiceType;

	public ContractDayPrice(){}

	public ContractDayPrice(Long orgId, String orgName, Long dsId, String dsCode, String day, String billTime, Integer billTimeType, Long conId, Long erpConId, String conCode, String conName, String clientName, String developmentUnits, String salesman, Long indentId, Long erpIndentId, String indentSite, Integer isAuto, Integer priceType, Long strengthId, String strengthLevel, Long techId, String techRequirements, Double saleStere, Double levelPrice, Double totalLevelPrice, Long pumpId, String pumpType, Double pumpPrice, Double totalPumpPrice, Integer saleCheck, String saleCheckStr, Long saleCheckUser, String saleCheckUserName, Date saleCheckTime, Integer financeCheck, String financeCheckStr, Long financeCheckUser, String financeCheckUserName, Date financeCheckTime, Integer status, Date createTime, String creater, Integer invoiceType) {
		this.orgId = orgId;
		this.orgName = orgName;
		this.dsId = dsId;
		this.dsCode = dsCode;
		this.day = day;
		this.billTime = billTime;
		this.billTimeType = billTimeType;
		this.conId = conId;
		this.erpConId = erpConId;
		this.conCode = conCode;
		this.conName = conName;
		this.clientName = clientName;
		this.developmentUnits = developmentUnits;
		this.salesman = salesman;
		this.indentId = indentId;
		this.erpIndentId = erpIndentId;
		this.indentSite = indentSite;
		this.isAuto = isAuto;
		this.priceType = priceType;
		this.strengthId = strengthId;
		this.strengthLevel = strengthLevel;
		this.techId = techId;
		this.techRequirements = techRequirements;
		this.saleStere = saleStere;
		this.levelPrice = levelPrice;
		this.totalLevelPrice = totalLevelPrice;
		this.pumpId = pumpId;
		this.pumpType = pumpType;
		this.pumpPrice = pumpPrice;
		this.totalPumpPrice = totalPumpPrice;
		this.saleCheck = saleCheck;
		this.saleCheckStr = saleCheckStr;
		this.saleCheckUser = saleCheckUser;
		this.saleCheckUserName = saleCheckUserName;
		this.saleCheckTime = saleCheckTime;
		this.financeCheck = financeCheck;
		this.financeCheckStr = financeCheckStr;
		this.financeCheckUser = financeCheckUser;
		this.financeCheckUserName = financeCheckUserName;
		this.financeCheckTime = financeCheckTime;
		this.status = status;
		this.createTime = createTime;
		this.creater = creater;
		this.invoiceType = invoiceType;
	}
}
